<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ include file="/WEB-INF/taglib.jsp"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/strict.dtd">
<meta name="renderer" content="ie-comp">
<html>
<head>
    <title>增加</title>
    <%@ include file="/WEB-INF/jsp/include.jsp"%>
    <script type="text/javascript">
        var path = "${path}";

        $(function() {

        });

        function setDefaultData(data) {
            if(data!=null){
                $("#shareholderName").val(data.shareholderName);
                $("#papersType").combobox("setValue",data.papersType);
                $("#papersCode").val(data.papersCode);
                $("#investmentRatio").val(data.investmentRatio);
                $("#incomeMoney").val(data.incomeMoney);
                $("#registeredAddress").val(data.registeredAddress);
            }
        }
        //保存增加的数据
        function btnSubmitAdd(flag) {

            if (!validform("shareholdertForm")) {
                return;
            }
            var returnValue = new Object();
            returnValue.shareholderName = $("#shareholderName").val();
            returnValue.papersType = $("#papersType").combobox("getValue");
            returnValue.papersCode = $("#papersCode").val();
            returnValue.investmentRatio = $("#investmentRatio").val();
            returnValue.incomeMoney = $("#incomeMoney").val();
            returnValue.registeredAddress = $("#registeredAddress").val();

            var papersType = $("#papersType").combobox("getValue");

            if(papersType == 1){

                if(!$("#papersCode").val() || !/^\d{6}(18|19|20)?\d{2}(0[1-9]|1[12])(0[1-9]|[12]\d|3[01])\d{3}(\d|X)$/i.test($("#papersCode").val())){
                    $.messager.alert("提示操作", "身份证号格式错误",function(){});
                    return;
                }
            }

            parent.window.callback(returnValue);
            setTimeout("closeLayer()", 100);
        }

        function btnCancelAdd() {
            closeLayer();
        }

    </script>
</head>

<body  style="margin:5px; padding:0px;" >
<%@ include file="/WEB-INF/jsp/loading.jsp" %>
<div class="easyui-layout" fit="true" >
    <div id="AddDlgDiv" align="center">
        <form id="shareholdertForm" method="post" >
            <table  class="f_table" cellspacing="1" align="center" >
                <tr>
                    <td align="right" class="s_bg" style="width:130px">股东名称：</td>
                    <td class="s_bg" style="width: 200px;height:25px;">
                        <input type="text" id="shareholderName" name="shareholderName" class="easyui-validatebox" data-options="required:true" style="width: 100%;height:100%;"/>
                    </td>
                    <td align="right" class="s_bg" style="width:130px;">证件类型：</td>
                    <td class="s_bg" style="width: 200px;height:25px;">

                        <select class="easyui-combobox" id="papersType" name="papersType" style="width:250px;" data-options="editable: false">
                            <%--<option value="">--请选择--</option>--%>
                            <c:forEach var="item"  items="${list}">
                                <option value="${item.dictCode}">${item.dictName}</option>
                            </c:forEach>
                        </select>

                    </td>
                </tr>
                <tr>
                    <td align="right" class="s_bg" style="width:130px">证件号码：</td>
                    <td class="s_bg" style="width: 200px;height:25px;">
                        <input type="text" id="papersCode" name ="papersCode" class="easyui-validatebox"   data-options="required:true,tipPosition:'left'" style="width:100%;height:100%;"/>
                    </td>
                    <td align="right"  class="s_bg" style="width:130px">投资比例：</td>
                    <td class="s_bg"  style="width: 200px;height:25px;">
                        <input type="text" id="investmentRatio" name="investmentRatio" class="easyui-validatebox"
                               onkeyup= "if( ! /^\d{0,9}(\.\d{0,2})?$/.test(this.value)){ $.messager.alert('提示操作', '只能保存小数点后两位',function(){});this.value='';}"  ng-pattern="/[^a-zA-Z]/" data-options="required:true" style="width:100%;height:100%;"/>
                    </td>
                </tr>
                <tr>
                    <td align="right" class="s_bg" style="width:130px">收益金额：</td>
                    <td class="s_bg" style="width: 200px;height:25px;">
                        <input type="text" id="incomeMoney" name="incomeMoney"  class="easyui-validatebox"
                               onkeyup= "if( ! /^\d{0,9}(\.\d{0,2})?$/.test(this.value)){ $.messager.alert('提示操作', '只能保存小数点后两位',function(){});this.value='';}"  ng-pattern="/[^a-zA-Z]/" data-options="required:true,tipPosition:'left'" style="width:100%;height:100%;"/>
                    </td>
                    <td align="right" class="s_bg" style="width:130px">国籍（注册地址）：</td>
                    <td class="s_bg" style="width: 200px;height:25px;">
                        <input type="text" id="registeredAddress" name="registeredAddress"  class="easyui-validatebox" data-options="required:true,tipPosition:'left'"  style="width:100%;height:100%;"/>
                    </td>
                </tr>
            </table>
        </form>
        <div align="center" style="margin-top: 15px;">
            <a href="javascript:void(0)" class="easyui-linkbutton" iconcls="icon-ok" onclick="btnSubmitAdd()">确定</a>
            <a href="javascript:void(0)" class="easyui-linkbutton" iconcls="icon-cancel" onclick="btnCancelAdd();">取消</a>
        </div>
    </div>
</div>
</body>
</html>
